import Vue from "vue"

import "normalize.css/normalize.css" // A modern alternative to CSS resets

import ElementUI from "element-ui"
import "element-ui/lib/theme-chalk/index.css"
import locale from "element-ui/lib/locale/lang/zh-CN" // lang i18n

import "@/styles/index.scss" // global css

import App from "./App"
import store from "./store"
import router from "./router"
import "@/icons" // icon
import "@/permission" // permission control
import Print from 'vue-print-nb'

import request from "@/utils/request"
import { getQueryString } from "@/utils"
import { setToken } from "@/utils/auth"
// 导出excle
import FileSaver from 'file-saver'
import * as XLSX from 'xlsx'

Vue.prototype.$FileSaver = FileSaver;
Vue.prototype.$XLSX = XLSX;
// set ElementUI lang to EN
Vue.use(Print)
Vue.use(ElementUI, { locale })
Vue.prototype.$http = request
Vue.config.productionTip = false

if (getQueryString("accessToken")) {
  const accessToken = getQueryString("accessToken")
  setToken(accessToken)
}

new Vue({
  el: "#app",
  router,
  store,
  render: (h) => h(App),
})
